package fr.web325.servlet.admin.notice;

import fr.web325.bean.Notice;
import fr.web325.dao.NoticeDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/shop/admin/modifyNotice")
public class ModifyNotice extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        try {
            Notice notice = new NoticeDao().getNoticeById(id);
            req.setAttribute("notice",notice);
            req.getRequestDispatcher("notice/modify.jsp").forward(req,resp);
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
